// JavaScript Document
function hasClass(obj,cls)
{
	return obj.className==cls?true:false;
}
function addClass(obj,cls)
{
	obj.className=cls;
}
function removeClass(obj,cls)
{
	obj.className="";
}

var width;
function fontsize()
{
	width=document.body.clientWidth||document.documentElement.clientWidth;
	var deviceWidth = document.documentElement.clientWidth||document.body.clientWidth;
	if(deviceWidth >640) deviceWidth = 640;
	document.documentElement.style.fontSize = deviceWidth / 7.5 + 'px';
}

setInterval(function(){
	fontsize();
},10)

fontsize();

window.onload=function()
{	
	var arrow=document.querySelectorAll('.arrow');
	for(var i=0;i<arrow.length;i++)
	{
		down(arrow[i]);
	}
	
	function down(obj)
	{
		var hid=obj.nextElementSibling||obj.nextSibling;		
		obj.addEventListener("touchend",function(){
			if(hasClass(hid,"hidden"))
			{
				removeClass(hid,"hidden");
				obj.style.backgroundPosition="0 -0.185rem";
			}
			else
			{
				addClass(hid,"hidden");
				obj.style.backgroundPosition="0 0";
			}
		},false);
	}
	
}
